/*
 * @Descripttion:
 * @version:
 * @Author: 穆宏宇
 * @Date: 2020-09-18 17:31:34
 * @LastEditors: 穆宏宇
 * @LastEditTime: 2020-11-04 16:28:04
 */
import api from './index'

// const ids = 'userId=11111111&unitId=11111111'

export const getError = () => {
  const url = '/error/info'
  const data = { a: 1, b: 2, c: 3 }
  return api.post(url, data)
}
/**
 * @description
 * @author 穆宏宇
 * @date 2020-09-21 14:23:11
 * @param  {String} form 登录信息
 * @param {String} Uuid 验证 Uuid
 * @return
 * */
export const login = (form,Uuid) => {
  const url = '/api/login'
  const data = { ...form }
  return api.post(url, data, true, Uuid)
}

export const logout = (form) => {
  const url = `/system/baseUser/logout?${ids}`
  const data = { ...form }
  return api.post(url, data)
}

// 注册
export const register = (form) => {
  const url = '/api/user/'
  const data = { ...form }
  return api.post(url, data)
}

// 获取左侧菜单 group 1 采购人 2 管理系统
export const getMenu = (id,group) => {
  // const url = `/api/menu/user/${id}`
  
  const url = `/special/dictionary/authmenu/getAuthMenuList/`
  return api.post(url,{
  	  authority:2
  })
}

// 获取验证码(图形)
export const getVerification = (Uuid) => {
  const url = '/api/login/verification'
  return api.get(url,{}, Uuid)
}

// 获取验证码(短信)
export const getMobileverifycode = (mobile) => {
  const url = `/api/notice/mobileverifycode/${mobile}`
  return api.post(url)
}

// 获取枚举列表
export const queryDictionaryList = (param) => {
  const url = '/vapi/shopdictionary/queryList'
  return api.get(url, param)
}

// 删除文件
export const deleteFile = (fileType,deleteKey) => {
  const url = `/api/file/remove/${fileType}/${deleteKey}`
  return api.delete(url)
}

// 批量删除文件（根据urls）
export const removeByUrls = (data) => {
  const url = `/api/file/removeByUrls`
  return api.post(url,data)
}

// 查询指定文件信息
export const getFileInfo = (fileType,sourceId) => {
  const url = `/api/file/getOne/${fileType}/${sourceId}`
  return api.get(url)
}

// 下载文件
export const downloadFile = (fileType,sourceId) => {
  const url = `/api/file/download/${fileType}/${sourceId}`
  return api.download(url)
}

// 查询文件URL
export const getFileUrl = (fileType,sourceId) => {
  const url = `/api/file/getUrl/${fileType}/${sourceId}`
  return api.get(url)
}

// 查询文件列表
export const queryFileList = (fileType,param) => {
  const url = `/api/file/queryList/${fileType}`
  return api.get(url,param)
}
